package com.czh.service;

import com.czh.dao.BooksMapper;
import com.czh.pojo.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
//@Service("BookServiceImpl")
public class BookServiceImpl implements BookService{
    private BooksMapper booksMapper;
//    @Autowired
    public void setBooksMapper(BooksMapper booksMapper) {
        this.booksMapper = booksMapper;
    }

    @Override
    public int AddBook(Book book) {
        return booksMapper.Add(book);
    }

    @Override
    public int DeleteBook(int bookID) {
        return booksMapper.Delete(bookID);
    }

    @Override
    public int UpdateBook(Book book) {
        return booksMapper.Update(book);
    }

    @Override
    public Book SelectBookById(int bookID) {
        return booksMapper.SelectById(bookID);
    }

    @Override
    public Book SelectBookByName(String bookName) {
        return booksMapper.SelectByName(bookName);
    }

    @Override
    public List<Book> SelectAllBook() {
        return booksMapper.SelectAll();
    }
}
